VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmRAR500 
   BackColor       =   &H00800000&
   Caption         =   "RAR500"
   ClientHeight    =   7680
   ClientLeft      =   435
   ClientTop       =   1410
   ClientWidth     =   10890
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   7680
   ScaleWidth      =   10890
   StartUpPosition =   2  'CenterScreen
   Begin MSAdodcLib.Adodc AdoRARINV 
      Height          =   375
      Left            =   720
      Top             =   600
      Visible         =   0   'False
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoRARINV"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Height          =   975
      Left            =   240
      TabIndex        =   24
      Top             =   5760
      Width           =   10455
      Begin VB.TextBox txtARBAM1 
         Height          =   315
         Left            =   1680
         TabIndex        =   27
         Top             =   480
         Width           =   1320
      End
      Begin VB.TextBox txtARBAM 
         Height          =   315
         Left            =   1680
         TabIndex        =   25
         Top             =   120
         Width           =   1320
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Tien phai tra"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   12
         Left            =   120
         TabIndex        =   28
         Top             =   480
         Width           =   1455
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Tien con phai thu"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   14
         Left            =   120
         TabIndex        =   26
         Top             =   210
         Width           =   1500
      End
   End
   Begin MSAdodcLib.Adodc AdoRARLine 
      Height          =   375
      Left            =   9120
      Top             =   0
      Visible         =   0   'False
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoRARLine"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc AdoCCM 
      Height          =   375
      Left            =   6960
      Top             =   0
      Visible         =   0   'False
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoCCM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc AdoRCM 
      Height          =   375
      Left            =   4800
      Top             =   0
      Visible         =   0   'False
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoRCM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc AdoRAR 
      Height          =   375
      Left            =   2520
      Top             =   0
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoRAR"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdReview 
      Caption         =   "&Review RAR"
      Height          =   456
      Left            =   270
      TabIndex        =   19
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   456
      Left            =   7080
      TabIndex        =   18
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "&Cancel"
      Height          =   456
      Left            =   5940
      TabIndex        =   17
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "&Save"
      Height          =   456
      Left            =   4815
      TabIndex        =   16
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdAddNew 
      Caption         =   "New &RAR"
      Height          =   456
      Left            =   1410
      TabIndex        =   15
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdNewItem 
      Caption         =   "New &line"
      Height          =   456
      Left            =   2550
      TabIndex        =   14
      Top             =   7020
      Width           =   1128
   End
   Begin VB.CommandButton cmdEdit 
      Caption         =   "&Edit"
      Height          =   456
      Left            =   3690
      TabIndex        =   13
      Top             =   7020
      Width           =   1128
   End
   Begin VB.Frame FrameRARLine 
      BackColor       =   &H00800000&
      BorderStyle     =   0  'None
      Caption         =   "Frame2"
      Height          =   1710
      Left            =   0
      TabIndex        =   12
      Top             =   3840
      Width           =   10695
      Begin MSDataGridLib.DataGrid GrdRAR 
         Bindings        =   "frmRAR500.frx":0000
         Height          =   1575
         Left            =   240
         TabIndex        =   22
         Top             =   360
         Width           =   10455
         _ExtentX        =   18441
         _ExtentY        =   2778
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   7
         BeginProperty Column00 
            DataField       =   "ARDOC"
            Caption         =   "Doc NO."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "ARMDC"
            Caption         =   "MDOC"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   -1  'True
            AllowSizing     =   -1  'True
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
            BeginProperty Column02 
            EndProperty
            BeginProperty Column03 
            EndProperty
            BeginProperty Column04 
            EndProperty
            BeginProperty Column05 
            EndProperty
            BeginProperty Column06 
            EndProperty
         EndProperty
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "RAR line No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   5
         Left            =   60
         TabIndex        =   20
         Top             =   45
         Width           =   1110
      End
   End
   Begin VB.Frame FrameLine 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Caption         =   "Base Balance"
      Height          =   735
      Left            =   195
      TabIndex        =   10
      Top             =   3120
      Width           =   10440
      Begin VB.TextBox txtARPAY 
         Height          =   375
         Left            =   7680
         TabIndex        =   43
         Top             =   120
         Width           =   2055
      End
      Begin VB.TextBox txttghdon 
         Height          =   405
         Left            =   3840
         TabIndex        =   29
         Top             =   120
         Width           =   1815
      End
      Begin MSDataListLib.DataCombo cboARMDC 
         Bindings        =   "frmRAR500.frx":0019
         Height          =   315
         Left            =   1560
         TabIndex        =   42
         Top             =   120
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "ARDOC"
         Text            =   ""
      End
      Begin VB.Label Label1 
         BackColor       =   &H00E0E0E0&
         Caption         =   "So tien tra"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Left            =   6120
         TabIndex        =   44
         Top             =   120
         Width           =   1215
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Tri gia hd"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   16
         Left            =   3000
         TabIndex        =   34
         Top             =   120
         Width           =   855
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "So hoa don"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   3
         Left            =   120
         TabIndex        =   11
         Top             =   120
         Width           =   1215
      End
   End
   Begin VB.Frame FrameRAR 
      BackColor       =   &H00800000&
      BorderStyle     =   0  'None
      Caption         =   "Frame2"
      Height          =   2190
      Left            =   120
      TabIndex        =   2
      Top             =   960
      Width           =   10395
      Begin MSAdodcLib.Adodc AdoINVOICE 
         Height          =   375
         Left            =   5400
         Top             =   0
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "Adodc1"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
      Begin VB.TextBox txtCMDSC 
         Height          =   285
         Left            =   2400
         TabIndex        =   39
         Top             =   1440
         Width           =   2235
      End
      Begin VB.TextBox txtARCER 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6240
         TabIndex        =   38
         Top             =   1470
         Width           =   1290
      End
      Begin VB.TextBox txtCMNME 
         BeginProperty Font 
            Name            =   "VNI-Helve"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   2400
         TabIndex        =   37
         Top             =   1080
         Width           =   2235
      End
      Begin VB.TextBox txtARORA 
         Height          =   285
         Left            =   4200
         TabIndex        =   35
         Top             =   1800
         Width           =   1335
      End
      Begin VB.TextBox txtARRMK 
         Height          =   285
         Left            =   1200
         TabIndex        =   31
         Top             =   600
         Width           =   5535
      End
      Begin VB.TextBox txtARAMT 
         Height          =   285
         Left            =   1200
         TabIndex        =   23
         Top             =   1800
         Width           =   1335
      End
      Begin VB.TextBox txtARDTE 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3540
         TabIndex        =   4
         Top             =   180
         Width           =   1200
      End
      Begin VB.TextBox txtARDOC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1200
         TabIndex        =   3
         Top             =   225
         Width           =   1215
      End
      Begin MSDataListLib.DataCombo cboARCCD 
         Bindings        =   "frmRAR500.frx":0032
         Height          =   315
         Left            =   1200
         TabIndex        =   40
         Top             =   1440
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "CMCCD"
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo cboARCNO 
         Bindings        =   "frmRAR500.frx":0047
         Height          =   315
         Left            =   1200
         TabIndex        =   41
         Top             =   1080
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "CMCNO"
         Text            =   ""
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "Tien VND"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   10
         Left            =   2640
         TabIndex        =   36
         Top             =   1800
         Width           =   1530
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "Dien giai"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   15
         Left            =   -45
         TabIndex        =   33
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "Tien Nte"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   8
         Left            =   -720
         TabIndex        =   21
         Top             =   1800
         Width           =   1770
      End
      Begin VB.Line Line1 
         X1              =   2160
         X2              =   5340
         Y1              =   5280
         Y2              =   4455
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "So phieu thu"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   2
         Left            =   -45
         TabIndex        =   9
         Top             =   270
         Width           =   1095
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "Ma khach hang"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   6
         Left            =   -240
         TabIndex        =   8
         Top             =   1140
         Width           =   1290
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Date"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   33
         Left            =   2985
         TabIndex        =   7
         Top             =   210
         Width           =   480
      End
      Begin VB.Label lbl 
         Alignment       =   1  'Right Justify
         BackStyle       =   0  'Transparent
         Caption         =   "Loai tien"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   34
         Left            =   225
         TabIndex        =   6
         Top             =   1440
         Width           =   825
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Ty gia"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   7
         Left            =   5085
         TabIndex        =   5
         Top             =   1500
         Width           =   1305
      End
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "So phieu thu"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   9
      Left            =   240
      TabIndex        =   32
      Top             =   1680
      Width           =   1095
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Index           =   4
      Left            =   3720
      TabIndex        =   30
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "RAR500"
      BeginProperty Font 
         Name            =   "VNI-Present"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   480
      Index           =   0
      Left            =   105
      TabIndex        =   1
      Top             =   0
      Width           =   1800
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Chung tu thu cong no"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   540
      Index           =   1
      Left            =   1995
      TabIndex        =   0
      Top             =   345
      Width           =   5535
   End
End
Attribute VB_Name = "frmRAR500"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim NewTrans As Byte
Dim oldARDOC As String
Dim oldARMDC As String



Private Sub CboARCCD_Click(Area As Integer)
If Area = 2 Then
    Dim RecCCI As Recordset
    Set RecCCI = DBconn.Execute("Select CCM.CMDSC,CCI.CICCR from CCI INNER JOIN CCM ON CCI.CICCD=CCM.CMCCD where CICCD='" & _
    cboARCCD.BoundText & "' order by CIDTE DESC")
    If Not RecCCI.EOF Then
        txtARCER = RecCCI!CICCR
        txtCMDSC = RecCCI!CMDSC
    Else
        txtARCER = 0
    End If
    RecCCI.Close
End If
End Sub

Private Sub CboARCCD_LostFocus()
    Dim RecCCI As Recordset
    Set RecCCI = DBconn.Execute("Select CCM.CMDSC,CCI.CICCR from CCI INNER JOIN CCM ON CCI.CICCD=CCM.CMCCD where CICCD='" & _
    cboARCCD.BoundText & "' order by CIDTE DESC")
    If Not RecCCI.EOF Then
        txtARCER = RecCCI!CICCR
        txtCMDSC = RecCCI!CMDSC
    Else
        txtARCER = 0
    End If
    RecCCI.Close
End Sub

Private Sub cboARCNO_Click(Area As Integer)
If Area = 2 Then
    Dim RecRCM As Recordset
    Set RecRCM = DBconn.Execute("Select CMNME FROM RCM")
    If Not RecRCM.EOF Then
        txtCMNME = RecRCM!CMNME
        
    Else
        txtCMNME = ""
    End If
    RecRCM.Close
End If
   
End Sub

Private Sub cboARCNO_LostFocus()
    Dim RecRCM As Recordset
    Set RecRCM = DBconn.Execute("Select CMNME FROM RCM")
    If Not RecRCM.EOF Then
        txtCMNME = RecRCM!CMNME
        
    Else
        txtCMNME = ""
    End If
    RecRCM.Close
End Sub

Private Sub cboARMDC_Change()
    txttghdon = Find("RAR", "ARORA", " WHERE ARDOC='" & cboARMDC & "'")
End Sub

Private Sub cboARMDC_Click(Area As Integer)
    sql = "SELECT ARDOC FROM RAR WHERE ARTYP='I' AND ARCNO='" & cboARCNO & "'"
    AdoINVOICE.ConnectionString = ConnectString
    AdoINVOICE.ConnectionTimeout = 10
    AdoINVOICE.CommandType = adCmdText
    AdoINVOICE.RecordSource = sql
    AdoINVOICE.Refresh
    txttghdon = Find("RAR", "ARORA", " WHERE ARDOC='" & cboARMDC & "'")
End Sub

Private Sub cmdAddnew_Click()
NewTrans = True
ISEDITING = True
ISADDING = True
WriteToScreen
ButtonStatus
End Sub

Private Sub cmdCancel_Click()
NewTrans = False
ISADDING = False
ISEDITING = False
ButtonStatus
End Sub

Private Sub cmdEdit_Click()
ISEDITING = True
'ISADDING = True
WriteToScreen
ButtonStatus

End Sub

Private Sub cmdexit_Click()
Unload frmRAR500
End Sub

Private Sub cmdNewItem_Click()
ISEDITING = True
ISADDING = True
WriteToScreen
ButtonStatus
End Sub

Private Sub cmdReview_Click()
frmReview.Tag = "RAR500"
frmReview.Show 1
ISEDITING = False
ISADDING = False
If frmReview.Tag <> "" Then
    txtARDOC = frmReview.GridList.Columns(1)
    cboARMDC = frmReview.GridList.Columns(2)
    Unload frmReview
    'txtBLLNE = 1
    WriteToScreen
End If
End Sub

Private Sub cmdSave_Click()
WriteToFile
ISADDING = False
ISEDITING = False
NewTrans = False
ButtonStatus
End Sub


Private Sub Form_Load()
OpenFile
End Sub

'Private Sub txtARBAM_KeyPress(KeyAscii As Integer)
'If KeyAscii = 13 Then
'    If KeyAscii = 13 Then
'        txtARAMT = Val(txtARBAM) * Val(txtARCER)
'        txtARAMT.SetFocus
'        CalculateRAR
'    End If
'End If
'End Sub

'Private Sub txtARCNO_KeyPress(KeyAscii As Integer)
'Dim Result As String
'If KeyAscii = 13 Then
'    Result = Find("RCM", "CMNME", "WHERE CMCNO='" & txtARCNO & "'")
'    If Result = "" Then
'        cboARCNO.Visible = True
'        cboARCNO.SetFocus
'    Else
'        cboARCNO.Visible = False
'        txtCMNME = Result
'        txtARCCD.SetFocus
'        AdoRAR.Refresh
'    End If
'End If
'End Sub
Sub OpenFile()
AdoRCM.ConnectionString = ConnectString
AdoRCM.ConnectionTimeout = 10
AdoRCM.CommandType = adCmdText
AdoRCM.RecordSource = "Select * from RCM"
AdoRCM.Refresh

AdoRAR.ConnectionString = ConnectString
AdoRAR.ConnectionTimeout = 10
AdoRAR.CommandType = adCmdText
AdoRAR.RecordSource = "SELECT RAR.* From RAR WHERE (ARDOC='" & txtARDOC & "')"
AdoRAR.Refresh

AdoCCM.ConnectionString = ConnectString
AdoCCM.ConnectionTimeout = 10
AdoCCM.CommandType = adCmdText
sql = "Select * from CCM"
AdoCCM.RecordSource = sql
AdoCCM.Refresh

AdoRARLine.ConnectionString = ConnectString
AdoRARLine.ConnectionTimeout = 10
AdoRARLine.CommandType = adCmdText
AdoRARLine.RecordSource = "SELECT RAR.* From RAR WHERE (ARDOC <> ARMDC)" & _
" and (ARDOC='" & txtARDOC & "') ORDER BY ARMDC"
AdoRARLine.Refresh

AdoRARINV.ConnectionString = ConnectString
AdoRARINV.ConnectionTimeout = 10
AdoRARINV.CommandType = adCmdText
AdoRARINV.RecordSource = "SELECT RAR.ARDOC From RAR WHERE (ARTYP='I')" & _
" and (ARCNO='" & cboARCNO & "') ORDER BY ARDOC"
AdoRARINV.Refresh

End Sub
Sub WriteToFile()
If IsDate(txtARDTE) Then txtARDTE = Format(txtARDTE, "yyyy-mm-dd hh:mm:ss")

If ISADDING Then
    'txtARDOC = TakeOrderNumberACN("CNNPN", True)
    sql = "Insert Into RAR (ARDOC,ARDTE,ARTYP,ARCNO,ARCCD,ARCER" & _
    ",ARMDC,ARAMT,ARORA,ARLUS,ARRMK,ARPAY) values " & _
    "('" & txtARDOC & "','" & txtARDTE & "','P','" & cboARCNO & "','" & cboARCCD & "','" & txtARCER & _
    "','" & cboARMDC & "','" & txtARAMT & "','" & txtARORA & "','" & UserLogin & "','" & "manual postting" & "','" & txtARPAY & "')"
Else
    sql = "UPDATE RAR SET ARDOC='" & txtARDOC & "', ARMDC='" & cboARMDC & "',ARDTE='" & txtARDTE & "',ARCNO='" & cboARCNO & "',ARCCD='" & cboARCCD & "',ARCER='" & txtARCER & _
    "',ARAMT='" & txtARAMT & "',ARORA='" & txtARORA & "',ARLUS='" & UserLogin & "',ARPAY='" & txtARPAY & _
    "' where  ARDOC='" & txtARDOC & "' and ARMDC='" & oldARMDC & "'"
End If
'MsgBox sql
DBconn.Execute (sql)
'Refresh lai du lieu
    oldARDOC = txtARDOC
    oldARMDC = cboARMDC
   AdoRARLine.RecordSource = "Select RAR.* from RAR " & _
    "  WHERE ARDOC='" & txtARDOC & "'"
AdoRARLine.Refresh
End Sub
Sub WriteToScreen()
If NewTrans Then
    txtARDOC = ""
    txtARDTE = WorkingDate
    cboARCNO = ""
    txtCMNME = ""
    cboARCCD = ""
    txtARCER = ""
    txtARPAY = 0
End If
'cboARMDC.Visible = False
If ISADDING Then
    cboARMDC = ""
    txtARPAY = 0
    txttghdon = 0
Else 'review
    Dim RecRAR As Recordset
    Set RecRAR = DBconn.Execute("Select * from RAR where ARDOC='" & txtARDOC & "'")
    With RecRAR
        txtARDOC = !ARDOC
        oldARDOC = txtARDOC
        txtARDTE = !ARDTE
        cboARCNO = !ARCNO
        txtCMNME = Find("RCM", "CMNME", " WHERE CMCNO='" & cboARCNO & "'")
        cboARCCD = !ARCCD
        txtCMDSC = Find("CCM", "CMDSC", " WHERE CMCCD='" & cboARCCD & "'")
        txtARCER = !ARCER
        cboARCCD = !ARCCD
        cboARMDC = !ARMDC
        oldARMDC = cboARMDC
        txttghdon = Find("RAR", "ARORA", " WHERE ARDOC='" & cboARMDC & "' AND ARTYP='I'")
        txtARAMT = !ARAMT
        txtARORA = !ARAMT
        txtARPAY = IIf(IsNull(!ARPAY), 0, !ARPAY)
    End With
End If

AdoRARLine.RecordSource = "Select RAR.* from RAR " & _
    "  WHERE  ARdoc='" & txtARDOC & "'"
AdoRARLine.Refresh
End Sub

Sub ButtonStatus()
cmdAddNew.Enabled = Not ISEDITING
cmdReview.Enabled = Not ISEDITING
cmdNewItem.Enabled = Not ISEDITING
cmdEdit.Enabled = Not ISEDITING
cmdSave.Enabled = ISEDITING
cmdCancel.Enabled = ISEDITING
FrameRAR.Enabled = NewTrans Or ISEDITING
FrameLine.Enabled = ISEDITING
FrameRARLine.Enabled = ISEDITING
End Sub


'Sub CalculateRAR()
'Dim recRARTotal, recRARPayment As Recordset, Payment, PaymentBase
'Set recRARTotal = DBconn.Execute("Select * from RAR where ARDOC='" & txtARDOC & "'")
'
'If Not recRARTotal.EOF Then
'    txtARBAM1 = recRARTotal!ARBAM
'    txtARAMT1 = recRARTotal!ARAMT
'End If
'Set recRARPayment = DBconn.Execute("Select * from RAR where ARMDC='" & txtARDOC & _
'"' AND ARMDC<>ARDOC AND ARDOC<" & txtARDOC)



Private Sub txtARAMT_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
        txtARORA = txtARAMT * txtARCER
      End If
End Sub

Private Sub txtARAMT_LostFocus()
    txtARORA = txtARAMT * txtARCER
End Sub

'Payment = 0
'PaymentBase = 0
'With recRARPayment
'    Do While Not .EOF
'        Payment = Payment + !ARAMT
'        PaymentBase = PaymentBase + !ARBAM
'        .MoveNext
'    Loop
'    .Close
'End With
'
'txtARBBL = Val(txtARBAM1) - PaymentBase - Val(txtARBAM)
'txtARBAL = Val(txtARAMT1) - Payment - Val(txtARAMT)
'End Sub
Private Sub txtARCER_Change()
    On Error Resume Next
    txtARORA = txtARCER * txtARAMT
End Sub

Private Sub txtARCER_LostFocus()
    On Error Resume Next
    txtARORA = txtARCER * txtARAMT
End Sub
Private Sub txtARDOC_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtARDOC.SetFocus
    End If
End Sub
Private Sub txtARDTE_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        If Not IsDate(txtARDTE) Then
            MsgBox "Date invalid"
        End If
    End If
End Sub
